from appEn import *
import numpy as np

data = np.loadtxt('example.txt')
ins = data[:,1]
m = 2

r_ins = 0.2*np.std(ins)
en_ins = apEn(ins,m,r_ins)
print('the apEn of ins is ',en_ins)

x_sin = np.linspace(0,20*np.pi,100)
y_sin = np.sin(x_sin)
r_sin = np.std(y_sin)
en_sin = apEn(y_sin,m,r_sin)
print('the apEn of sine data is ',en_sin)

y_rand = np.random.rand(200)
r_rand = np.std(y_rand)
en_rand = apEn(y_rand,m,r_rand)
print('the apEn of random data is ',en_rand)


